<?php
/*
 * 百度类型的siteMap文件
 */
class Libs_SiteMap_Baidu extends Libs_SiteMap_Base{
    function __construct(){
		$this->head = '<?xml version="1.0" encoding="utf-8"?>';
		$this->head .="\n";
		$this->head .= '<urlset>';
		$this->head .="\n";
		$this->footer = '</urlset>';
    }
    /**
     * 生成链接区域
     * @param array $dataArr 数据数组 loc lastmod changefreq priority
     */
    function createSection(&$dataArr){
        $outstr = '';
        if(empty($dataArr))return '';
        foreach ($dataArr as $data) {
        	$outstr .= "<url>\n";

			$outstr .= "<loc>".$data['loc']."</loc>\n";
        	if(!empty($data['lastmod']))$outstr .= "<lastmod>".$data['lastmod']."</lastmod>\n";
        	//if(!empty($data['changefreq']))$outstr .= "<changefreq>".$data['changefreq']."</changefreq>\n";
        	//if(!empty($data['priority']))$outstr .= "<priority>".$data['priority']."</priority>\n";

        	$outstr .= "</url>\n";
        }
        return $outstr;
    }
}


?>
